package cn.lzm.controller;

import cn.lzm.AjaxResult;
import cn.lzm.domain.Product;
import cn.lzm.server.IProductService;
import cn.lzm.server.IStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private IProductService productService;
    @PostMapping
    public AjaxResult addOne(@RequestBody Product product){
       return productService.addOne(product);

    }
    @GetMapping
    public List<Product> selectAll(){
        List<Product> products = productService.selectAll();
        return products;
    }
}
